<template>
	<public-view navColor="#ffffff" topBgShow="3" navType="goodList" navTitle="列表">
		<view class="content flex j-c-b f-w-w">
			<block v-for="(item, index) in top_goods_list" :key="index">
				<goods-item :item="item"></goods-item>
			</block>
		</view>
	</public-view>
</template>

<script>
	import {getStorClassList,getGoodsList} from "@/utils/pagePublic.js"
	import {goTo} from "@/nav.js"
	import goodsItem from "./components/goodItem.vue"
	export default {
		components:{
			"goods-item":goodsItem
		},
		data() {
			return {
				top_goods_list:[],
				class_id:"",
				top_class_id:""
			};
		},
		computed:{
			keywords(){
				return this.$store.state.goods_keywords || ""
			}
		},
		watch:{
			"$store.state.goods_keywords"(nval,oval){
				this.top_goods_list=[]
				this.getGoodsListA()
			}
		},
		onLoad(o) {
			this.class_id = o.class_id
			this.top_class_id = o.top_class_id
			this.getGoodsListA()
		},
		methods:{
			getGoodsListA(){
				let that = this
				getGoodsList({
					merchant_id:"",
					class_id:that.class_id,
					top_class_id:that.top_class_id,
					keyword:that.keywords
				},res=>{
					console.log(res)
					that.top_goods_list = res.data.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		width: 100%;
		padding: 20upx;
	}
</style>
